home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 661 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.8 KB

  1. From: Andreas Schwab <schwab@lamothe.informatik.uni-dortmund.de>
  2. Date: Tue, 23 Nov 93 11:09:50 +0100
  3. Message-Id: <9311231009.AA01158@lamothe.informatik.uni-dortmund.de>
  4. To: mint@atari.archive.umich.edu
  5. Subject: MiNT 1.09: some protection for biosfs
  6.  
  7. Most of the function of biosfs that change it should only be allowed
  8. by root, IMHO.  This patch adds checks to bios_remove, bios_rename,
  9. bios_fscntl and bios_symlink. Additionally i have added a check for
  10. existence of the new name in bios_rename.
  11.  
  12. --- orig/biosfs.c    Tue Aug 17 21:23:18 1993
  13. +++ biosfs.c    Mon Nov 22 19:58:30 1993
  14. @@ -358,6 +358,9 @@
  15.      struct bios_file *b, **lastb;
  16.  
  17.      UNUSED(dir);
  18. +    if (curproc->euid)
  19. +      return EACCDN;
  20. +
  21.      lastb = &broot;
  22.      for (b = broot; b; b = *(lastb = &b->next)) {
  23.          if (!stricmp(b->name, name)) break;
  24. @@ -401,18 +404,24 @@
  25.      fcookie *newdir;
  26.      const char *newname;
  27.  {
  28. -    struct bios_file *b;
  29. +    struct bios_file *b, *be = 0;
  30.  
  31.      UNUSED(olddir); UNUSED(newdir);
  32.  
  33. -/* BUG: we should check to see if "newname" already exists */
  34. +    if (curproc->euid)
  35. +      return EACCDN;
  36.  
  37.      for (b = broot; b; b = b->next) {
  38. -        if (!stricmp(b->name, oldname)) {
  39. -            strncpy(b->name, newname, BNAME_MAX);
  40. -            return 0;
  41. -        }
  42. -    }
  43. +        if (!stricmp (b->name, newname))
  44. +          return EACCDN;
  45. +        if (!stricmp(b->name, oldname))
  46. +          be = b;
  47. +    }
  48. +    if (be)
  49. +      {
  50. +        strncpy(be->name, newname, BNAME_MAX);
  51. +        return 0;
  52. +      }
  53.      return EFILNF;
  54.  }
  55.  
  56. @@ -552,6 +561,9 @@
  57.      struct bios_file *b;
  58.  
  59.      UNUSED(dir);
  60. +    if (curproc->euid)
  61. +      return EACCDN;
  62. +
  63.      if ((unsigned)cmd == DEV_INSTALL) {
  64.          struct dev_descr *d = (struct dev_descr *)arg;
  65.  
  66. @@ -608,6 +620,9 @@
  67.      struct bios_file *b;
  68.      long r;
  69.      fcookie fc;
  70. +
  71. +    if (curproc->euid)
  72. +      return EACCDN;
  73.  
  74.      r = bios_lookup(dir, name, &fc);
  75.      if (r == 0) return EACCDN;    /* file already exists */
  76.